projects
/
cargo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
96c5b8f
)
Avoid overwriting the lockfile if there are no changes
author
Gleb Kozyrev
<gleb@gkoz.com>
Fri, 30 Oct 2015 11:18:19 +0000
(13:18 +0200)
committer
Gleb Kozyrev
<gleb@gkoz.com>
Fri, 30 Oct 2015 18:51:26 +0000
(20:51 +0200)
src/cargo/ops/lockfile.rs
patch
|
blob
|
history
diff --git
a/src/cargo/ops/lockfile.rs
b/src/cargo/ops/lockfile.rs
index da8aac7a108555e48516787bb5dde63bddb57457..3a0ef553f982205127829c7f695e990120485281 100644
(file)
--- a/
src/cargo/ops/lockfile.rs
+++ b/
src/cargo/ops/lockfile.rs
@@
-68,6
+68,15
@@
pub fn write_lockfile(dst: &Path, resolve: &Resolve) -> CargoResult<()> {
None => {}
}
+ // Load the original lockfile if it exists.
+ if let Ok(orig) = paths::read(dst) {
+ if out == orig {
+ // The lockfile contents haven't changed so don't rewrite it.
+ // This is helpful on read-only filesystems.
+ return Ok(())
+ }
+ }
+
try!(paths::write(dst, out.as_bytes()));
Ok(())
}